use std::process::Command;
fn run(name:String)->(String,String){
let command = format!("nslookup -type=AAAA {}|grep Address",name);
let output = Command::new("sh").arg("-c").arg(command).output().expect("命令执行异常错误提示");
let ls_la_list = String::from_utf8(output.stdout).unwrap();
let sfa:Vec<&str>  = ls_la_list.split("\n").collect();
let ipv6_some:Vec<&str>  = sfa[1].split(":").collect();
let ipv6_left = format!("{}:{}:{}:{}",ipv6_some[1].trim(),ipv6_some[2],ipv6_some[3],ipv6_some[4]);


let ipv6_right = format!("{}:{}:{}:{}",ipv6_some[5],ipv6_some[6],ipv6_some[7],ipv6_some[8]);


(ipv6_left,ipv6_right)


}

fn main(){

let (home1,home2) =   run(String::from("home.sinzuo.com"));
let (ceph3,ceph4) =   run(String::from("ceph.sinzuo.com"));

print!("{}:{} ceph2\n",home1,home2);
print!("{}:{} ceph1\n",home1,ceph3);
print!("{}:{} ceph3\n",home1,ceph4);
}
